//将一句话的单词进行倒置，标点不倒置。比如 I like beijing. 经过函数后变为：beijing. like I
import java.util.Scanner;
public class Main{
    public static String reverseString(String s,int begin,int end) {
        char[] array = s.toCharArray();
        while (begin <= end) {
            char tmp = array[begin];
            array[begin] = array[end];
            array[end] = tmp;
            begin++;
            end--;
        }
        return new String(array);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        str = reverseString(str,0,str.length()-1);
        int left = 0,  right = 0;
        for (int i = 0; i < str.length()-1; i++) {
            left = i;
            i++;
            while (str.charAt(i) != ' ') {
                if (i == str.length()-1) {
                    right = i;
                    break;
                }
                i++;
                right = i-1;
            }
            str = reverseString(str,left,right);
        }

        System.out.println(str);
    }
}